﻿Imports ReglasNegocio
Imports System.Collections.Generic
Imports System.Data

Partial Public Class Bandeja_Almacen_Excel
    Inherits System.Web.UI.Page
    Protected strFechaActual As String
    Protected strHoraActual As String
    Protected ParamLocal, ParamGrupo, ParamItem As String
    Protected ParamNomLocal, ParamNomGrupo, ParamNomItem As String
    Protected dsConsulta As New DataSet

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Put user code to initialize the page here
        Response.Expires = 0
        Response.ContentEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1")
        Response.ContentType = "application/xls"
        Response.AppendHeader("Content-disposition", "attachment; filename=Reporte_AlmacenxDia.xls")
        SRT_RecuperacionFechas()
        CargaStock(PreviousPage.CodLocalExcel, PreviousPage.CodItemExcel, PreviousPage.NomItemExcel, PreviousPage.CodGrupoExcel)
    End Sub
    Private Sub SRT_RecuperacionFechas()
        strFechaActual = Format(DateTime.Now.Date, "dd/MM/yyyy")
        Dim minuto As String
        If DateTime.Now.Minute < 10 Then
            minuto = "0" & DateTime.Now.Minute
        Else
            minuto = DateTime.Now.Minute
        End If
        strHoraActual = DateTime.Now.Hour & ":" & minuto
    End Sub


    Private Sub CargaStock(ByVal pstrLocal As String, ByVal pstrItem As String, ByVal pstrNomItem As String, ByVal pstrGrupo As String)
        ParamLocal = pstrLocal
        ParamGrupo = pstrGrupo
        ParamItem = pstrItem
        Dim Catalogo As CatalogoAlmacen = New CatalogoAlmacen()
        dsConsulta = Catalogo.BandejaStock(pstrLocal, pstrItem, pstrNomItem, pstrGrupo, "0")
        ParamNomLocal = PreviousPage.NomLocalExcel
        ParamNomGrupo = PreviousPage.NomGrupoExcel
    End Sub

End Class

